// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name:   CMPP30SubmitMessage.java

package com.haoxi.gateway.test.message;


import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import com.haoxi.gateway.test.CMPPConstant;
import com.haoxi.gateway.test.util.TypeConvert;

public class CMPP30SubmitMessage extends CMPPMessage {
    private int msgId;

    private int DestUsr_tl;

    private String outStr;

    private int pk_Total;

    private int pk_Number;

    private int registered_Delivery;

    private int msg_Level;

    private String service_Id;

    private int fee_UserType;

    private String fee_Terminal_Id;

    private int fee_Terminal_Type;

    private int tp_Pid;

    private int tp_Udhi;

    private int msg_Fmt;

    private String msg_Src;

    private String fee_Type;

    private String fee_Code;

    private Date valid_Time;

    private Date at_Time;

    private String src_Terminal_Id;

    private String dest_Terminal_Id[];

    private int dest_Terminal_Type;

    private byte msg_Content[];

    private int msg_length;

    private String linkID;


    public CMPP30SubmitMessage(byte[] buf) throws IllegalArgumentException {
        super.buf = new byte[buf.length];
        System.arraycopy(buf, 0, super.buf, 0, buf.length);
        super.buf = new byte[buf.length];
        System.arraycopy(buf, 0, super.buf, 0, buf.length);
        // 消息头
        message_Length = TypeConvert.byte2int(super.buf, 0);
        command_ID = TypeConvert.byte2int(super.buf, 4);
        sequence_Id = TypeConvert.byte2int(super.buf, 8);
    }

    public int getMsgId() {
        byte[] tmp = new byte[8];
        System.arraycopy(this.buf, 12, tmp, 0, 8);
        this.msgId = TypeConvert.byte2int(tmp);
        return msgId;
    }

    public int getPk_Total() {
        pk_Total = buf[20];
        return pk_Total;
    }

    public int getPk_Number() {
        pk_Number = buf[21];
        return pk_Number;
    }

    public int getRegistered_Delivery() {
        registered_Delivery = buf[22];
        return registered_Delivery;
    }

    public int getMsg_Level() {
        msg_Level = buf[23];
        return msg_Level;
    }

    public String getService_Id() {
        byte[] tmp = new byte[10];
        System.arraycopy(buf, 24, tmp, 0, 10);
        String temStr = new String(tmp).trim();
        if (temStr.indexOf(0) >= 0)
            service_Id = temStr.substring(0, temStr.indexOf(0));
        else
            service_Id = temStr;
        return service_Id;
    }

    public int getFee_UserType() {
        fee_UserType = buf[34];
        return fee_UserType;
    }

    public String getFee_Terminal_Id() {
        byte[] tmp = new byte[32];
        System.arraycopy(buf, 35, tmp, 0, 32);
        String temStr = new String(tmp).trim();
        if (temStr.indexOf(0) >= 0)
            fee_Terminal_Id = temStr.substring(0, temStr.indexOf(0));
        else
            fee_Terminal_Id = temStr;
        return fee_Terminal_Id;
    }

    public int getFee_Terminal_Type() {
        fee_Terminal_Type = buf[67];
        return fee_Terminal_Type;
    }

    public int getTp_Pid() {
        tp_Pid = buf[68];
        return this.tp_Pid;
    }

    public int getTp_Udhi() {
        this.tp_Udhi = buf[69];
        return tp_Udhi;
    }

    public int getMsg_Fmt() {
        msg_Fmt = buf[70];
        return msg_Fmt;
    }

    public String getMsg_Src() {
        byte[] tmp = new byte[6];
        System.arraycopy(buf, 71, tmp, 0, 6);
        String temStr = new String(tmp).trim();
        if (temStr.indexOf(0) >= 0)
            msg_Src = temStr.substring(0, temStr.indexOf(0));
        else
            msg_Src = temStr;
        return msg_Src;
    }

    public String getFee_Type() {
        byte[] tmp = new byte[2];
        System.arraycopy(buf, 77, tmp, 0, 2);
        String temStr = new String(tmp).trim();
        if (temStr.indexOf(0) >= 0)
            fee_Type = temStr.substring(0, temStr.indexOf(0));
        else
            fee_Type = temStr;
        return fee_Type;
    }

    public String getFee_Code() {
        byte[] tmp = new byte[6];
        System.arraycopy(buf, 79, tmp, 0, 6);
        String temStr = new String(tmp).trim();
        if (temStr.indexOf(0) >= 0)
            fee_Code = temStr.substring(0, temStr.indexOf(0));
        else
            fee_Code = temStr;
        return fee_Code;
    }

    public Date getValid_Time() {
        byte tmpId[] = new byte[17];
        System.arraycopy(buf, 85, tmpId, 0, 17);
        String tmpstr = new String(tmpId).trim();
        if (!"".equals(tmpstr)) {
            byte tmpbyte[] = new byte[2];
            System.arraycopy(tmpId, 0, tmpbyte, 0, 2);
            String temp = new String(tmpbyte);
            int year = Integer.parseInt(temp);
            System.arraycopy(tmpId, 2, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int mm = Integer.parseInt(temp);
            System.arraycopy(tmpId, 4, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int dd = Integer.parseInt(temp);
            System.arraycopy(tmpId, 6, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int hh = Integer.parseInt(temp);
            System.arraycopy(tmpId, 8, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int min = Integer.parseInt(temp);
            System.arraycopy(tmpId, 10, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int ss = Integer.parseInt(temp);
            Calendar calendar = Calendar.getInstance();
            calendar.set(year, mm - 1, dd, hh, min, ss);
            this.valid_Time = calendar.getTime();
        }
        return valid_Time;
    }

    public Date getAt_Time() {
        byte tmpId[] = new byte[17];
        System.arraycopy(buf, 102, tmpId, 0, 17);
        String tmpstr = new String(tmpId).trim();
        if (!"".equals(tmpstr)) {
            byte tmpbyte[] = new byte[2];
            System.arraycopy(tmpId, 0, tmpbyte, 0, 2);
            String temp = new String(tmpbyte);
            int year = Integer.parseInt(temp);
            System.arraycopy(tmpId, 2, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int mm = Integer.parseInt(temp);
            System.arraycopy(tmpId, 4, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int dd = Integer.parseInt(temp);
            System.arraycopy(tmpId, 6, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int hh = Integer.parseInt(temp);
            System.arraycopy(tmpId, 8, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int min = Integer.parseInt(temp);
            System.arraycopy(tmpId, 10, tmpbyte, 0, 2);
            temp = new String(tmpbyte);
            int ss = Integer.parseInt(temp);
            Calendar calendar = Calendar.getInstance();
            calendar.set(year, mm - 1, dd, hh, min, ss);
            at_Time = calendar.getTime();
        }
        return at_Time;
    }

    public String getSrc_Terminal_Id() {

        byte[] tmp = new byte[21];
        System.arraycopy(buf, 119, tmp, 0, 21);
        String temStr = new String(tmp).trim();
        if (temStr.indexOf(0) >= 0)
            src_Terminal_Id = temStr.substring(0, temStr.indexOf(0));
        else
            src_Terminal_Id = temStr;
        return src_Terminal_Id;
    }

    public int getDestUsr_tl() {
        DestUsr_tl = buf[140];
        return DestUsr_tl;
    }

    public String[] getDest_Terminal_Id() {
        byte[] tmp = new byte[32];
        int DestUsr_tl = buf[140];
        String[] result = new String[DestUsr_tl];
        for (int i = 0; i < DestUsr_tl; i++) {
            System.arraycopy(buf, 141 + i * 32, tmp, 0, 32);
            String tmpStr = (new String(tmp)).trim();
            if (tmpStr.indexOf(0) >= 0) {
                result[i] = tmpStr.substring(0, tmpStr.indexOf(0));
            } else {
                result[i] = tmpStr;
            }
        }
        return result;
    }

    public int getDest_Terminal_Type() {
        int loc = 141 + buf[140] * 32;
        this.dest_Terminal_Type = buf[loc];
        return dest_Terminal_Type;

    }

    public int getMsg_length() {
        int loc = 142 + buf[140] * 32;
        this.msg_length = buf[loc];
        return msg_length;
    }

    public byte[] getMsg_Content() {
        int loc = 143 + buf[140] * 32;
        int len = this.getMsg_length();
        msg_Content = new byte[len];
        System.arraycopy(buf, loc, msg_Content, 0, len);
        return msg_Content;
    }

    public String getLinkID() {
        int loc = 143 + buf[140] * 32 + getMsg_length();
        byte[] tmp = new byte[20];
        System.arraycopy(buf, loc, tmp, 0, 20);
        String temStr = new String(tmp).trim();
        if (temStr.indexOf(0) >= 0)
            linkID = temStr.substring(0, temStr.indexOf(0));
        else
            linkID = temStr;
        return linkID;
        // return linkID;
    }

    public CMPP30SubmitMessage(int pk_Total, int pk_Number,
            int registered_Delivery, int msg_Level, String service_Id,
            int fee_UserType, String fee_Terminal_Id, int fee_Terminal_Type,
            int tp_Pid, int tp_Udhi, int msg_Fmt, String msg_Src,
            String fee_Type, String fee_Code, Date valid_Time, Date at_Time,
            String src_Terminal_Id, String dest_Terminal_Id[],
            int dest_Terminal_Type, byte msg_Content[], String LinkID)
            throws IllegalArgumentException {
        if (pk_Total < 1 || pk_Total > 255) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":").append(CMPPConstant.PK_TOTAL_ERROR))));
        }
        if (pk_Number < 1 || pk_Number > 255) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":").append(CMPPConstant.PK_NUMBER_ERROR))));
        }
        if (registered_Delivery < 0 || registered_Delivery > 1) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":").append(
                                    CMPPConstant.REGISTERED_DELIVERY_ERROR))));
        }
        if (msg_Level < 0 || msg_Level > 255) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":msg_Level").append(
                                    CMPPConstant.INT_SCOPE_ERROR))));
        }
        if (service_Id.length() > 10) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":service_Id").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "10"))));
        }
        if (fee_UserType < 0 || fee_UserType > 3) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":")
                            .append(CMPPConstant.FEE_USERTYPE_ERROR))));
        }
        if (fee_Terminal_Id.length() > 32) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":fee_Terminal_Id").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "32"))));
        }
        if (fee_Terminal_Type < 0 || fee_Terminal_Type > 255) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":fee_terminal_type").append(
                                    CMPPConstant.INT_SCOPE_ERROR))));
        }
        if (tp_Pid < 0 || tp_Pid > 255) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":tp_Pid").append(
                                    CMPPConstant.INT_SCOPE_ERROR))));
        }
        if (tp_Udhi < 0 || tp_Udhi > 255) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":tp_Udhi").append(
                                    CMPPConstant.INT_SCOPE_ERROR))));
        }
        if (msg_Fmt < 0 || msg_Fmt > 255) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":msg_Fmt").append(
                                    CMPPConstant.INT_SCOPE_ERROR))));
        }
        if (msg_Src.length() > 6) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":msg_Src").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "6"))));
        }
        if (fee_Type.length() > 2) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":fee_Type").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "2"))));
        }
        if (fee_Code.length() > 6) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":fee_Code").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "6"))));
        }
        if (src_Terminal_Id.length() > 21) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":src_Terminal_Id").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "21"))));
        }
        if (dest_Terminal_Id.length > 100) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":dest_Terminal_Id").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "100"))));
        }
        for (int i = 0; i < dest_Terminal_Id.length; i++) {
            if (dest_Terminal_Id[i].length() > 32) {
                throw new IllegalArgumentException(String.valueOf(String
                        .valueOf((new StringBuffer(String.valueOf(String
                                .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                                .append(":dest_Terminal_Id").append(
                                        CMPPConstant.STRING_LENGTH_GREAT)
                                .append("32"))));
            }
        }

        if (dest_Terminal_Type < 0 || dest_Terminal_Type > 255) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":dest_terminal_type").append(
                                    CMPPConstant.INT_SCOPE_ERROR))));
        }
        if (msg_Fmt == 0) {
            if (msg_Content.length > 160) {
                throw new IllegalArgumentException(String.valueOf(String
                        .valueOf((new StringBuffer(String.valueOf(String
                                .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                                .append(":msg_Content").append(
                                        CMPPConstant.STRING_LENGTH_GREAT)
                                .append("160"))));
            }
        } else if (msg_Content.length > 140) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":msg_Content").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "140"))));
        }
        if (LinkID.length() > 20) {
            throw new IllegalArgumentException(String.valueOf(String
                    .valueOf((new StringBuffer(String.valueOf(String
                            .valueOf(CMPPConstant.SUBMIT_INPUT_ERROR))))
                            .append(":LinkID").append(
                                    CMPPConstant.STRING_LENGTH_GREAT).append(
                                    "20"))));
        }
        int len = 163 + 32 * dest_Terminal_Id.length + msg_Content.length;
        buf = new byte[len];
        TypeConvert.int2byte(len, buf, 0);
        TypeConvert.int2byte(4, buf, 4);
        buf[20] = (byte) pk_Total;
        buf[21] = (byte) pk_Number;
        buf[22] = (byte) registered_Delivery;
        buf[23] = (byte) msg_Level;
        System
                .arraycopy(service_Id.getBytes(), 0, buf, 24, service_Id
                        .length());
        buf[34] = (byte) fee_UserType;
        System.arraycopy(fee_Terminal_Id.getBytes(), 0, buf, 35,
                fee_Terminal_Id.length());
        buf[67] = (byte) fee_Terminal_Type;
        buf[68] = (byte) tp_Pid;
        buf[69] = (byte) tp_Udhi;
        buf[70] = (byte) msg_Fmt;
        System.arraycopy(msg_Src.getBytes(), 0, buf, 71, msg_Src.length());
        System.arraycopy(fee_Type.getBytes(), 0, buf, 77, fee_Type.length());
        System.arraycopy(fee_Code.getBytes(), 0, buf, 79, fee_Code.length());
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss");
        if (valid_Time != null) {
            String tmpTime = String.valueOf(
                    String.valueOf(dateFormat.format(valid_Time))).concat(
                    "032+");
            System.arraycopy(tmpTime.getBytes(), 0, buf, 85, 16);
        }
        if (at_Time != null) {
            String tmpTime = String.valueOf(
                    String.valueOf(dateFormat.format(at_Time))).concat("032+");
            System.arraycopy(tmpTime.getBytes(), 0, buf, 102, 16);
        }
        System.arraycopy(src_Terminal_Id.getBytes(), 0, buf, 119,
                src_Terminal_Id.length());
        buf[140] = (byte) dest_Terminal_Id.length;
        int i = 0;
        for (i = 0; i < dest_Terminal_Id.length; i++) {
            System.arraycopy(dest_Terminal_Id[i].getBytes(), 0, buf,
                    141 + i * 32, dest_Terminal_Id[i].length());
        }

        int loc = 141 + i * 32;
        buf[loc] = (byte) dest_Terminal_Type;
        loc++;
        buf[loc] = (byte) msg_Content.length;
        loc++;
        System.arraycopy(msg_Content, 0, buf, loc, msg_Content.length);
        loc += msg_Content.length;
        System.arraycopy(LinkID.getBytes(), 0, buf, loc, LinkID.length());
        outStr = ",msg_id=00000000";
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",pk_Total=").append(
                pk_Total)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",pk_Number=")
                .append(pk_Number)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(
                ",registered_Delivery=").append(registered_Delivery)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",msg_Level=")
                .append(msg_Level)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",service_Id=")
                .append(service_Id)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",fee_UserType=")
                .append(fee_UserType)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",fee_Terminal_Id=")
                .append(fee_Terminal_Id)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr))))
                .append(",fee_Terminal_type=").append(fee_Terminal_Type)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",tp_Pid=").append(
                tp_Pid)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",tp_Udhi=").append(
                tp_Udhi)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",msg_Fmt=").append(
                msg_Fmt)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",msg_Src=").append(
                msg_Src)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",fee_Type=").append(
                fee_Type)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",fee_Code=").append(
                fee_Code)));
        if (valid_Time != null) {
            outStr = String.valueOf(String.valueOf((new StringBuffer(String
                    .valueOf(String.valueOf(outStr)))).append(",valid_Time=")
                    .append(dateFormat.format(valid_Time))));
        } else {
            outStr = String.valueOf(String.valueOf(outStr)).concat(
                    ",valid_Time=null");
        }
        if (at_Time != null) {
            outStr = String.valueOf(String.valueOf((new StringBuffer(String
                    .valueOf(String.valueOf(outStr)))).append(",at_Time=")
                    .append(dateFormat.format(at_Time))));
        } else {
            outStr = String.valueOf(String.valueOf(outStr)).concat(
                    ",at_Time=null");
        }
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",src_Terminal_Id=")
                .append(src_Terminal_Id)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",destusr_Tl=")
                .append(dest_Terminal_Id.length)));
        for (int t = 0; t < dest_Terminal_Id.length; t++) {
            outStr = String.valueOf(String.valueOf((new StringBuffer(String
                    .valueOf(String.valueOf(outStr)))).append(
                    ",dest_Terminal_Id[").append(t).append("]=").append(
                    dest_Terminal_Id[t])));
        }

        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(
                ",dest_Terminal_type=").append(dest_Terminal_Type)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",msg_Length=")
                .append(msg_Content.length)));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",msg_Content=")
                .append(new String(msg_Content))));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(",LinkID=").append(
                LinkID)));
    }

    public String toString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss");
        String tmpStr = "CMPP_Submit: ";
        tmpStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(tmpStr)))).append("\r\nMessageLength=")
                .append(getMessage_Length())));
        tmpStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(tmpStr)))).append("\r\nCommid=")
                .append(getCommandId())));
        tmpStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(tmpStr)))).append("\r\nSequence_Id=")
                .append(getSequenceId())));
        outStr = "\r\nmsg_id=00000000";
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\npk_Total=").append(
                this.getPk_Total())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\npk_Number=")
                .append(this.getPk_Number())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(
                "\r\nregistered_Delivery=").append(this.getRegistered_Delivery())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nmsg_Level=")
                .append(this.getMsg_Level())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nservice_Id=")
                .append(this.getService_Id())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nfee_UserType=")
                .append(this.getFee_UserType())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nfee_Terminal_Id=")
                .append(this.getFee_Terminal_Id())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr))))
                .append("\r\nfee_Terminal_type=").append(this.getFee_Terminal_Type())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\ntp_Pid=").append(
                this.getTp_Pid())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\ntp_Udhi=").append(
                this.getTp_Udhi())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nmsg_Fmt=").append(
                this.getMsg_Fmt())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nmsg_Src=").append(
                this.getMsg_Src())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nfee_Type=").append(
                this.getFee_Type())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nfee_Code=").append(
                this.getFee_Code())));
        if (valid_Time != null) {
            outStr = String.valueOf(String.valueOf((new StringBuffer(String
                    .valueOf(String.valueOf(outStr)))).append("\r\nvalid_Time=")
                    .append(dateFormat.format(this.getValid_Time()))));
        } else {
            outStr = String.valueOf(String.valueOf(outStr)).concat(
                    "\r\nvalid_Time=null");
        }
        if (at_Time != null) {
            outStr = String.valueOf(String.valueOf((new StringBuffer(String
                    .valueOf(String.valueOf(outStr)))).append("\r\nat_Time=")
                    .append(dateFormat.format(this.getAt_Time()))));
        } else {
            outStr = String.valueOf(String.valueOf(outStr)).concat(
                    "\r\nat_Time=null");
        }
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nsrc_Terminal_Id=")
                .append(this.getSrc_Terminal_Id())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\ndestusr_Tl=")
                .append(this.getDestUsr_tl())));
        String[] userNumber=this.getDest_Terminal_Id();
        for (int t = 0; t < getDestUsr_tl(); t++) {
            outStr = String.valueOf(String.valueOf((new StringBuffer(String
                    .valueOf(String.valueOf(outStr)))).append(
                    "\r\ndest_Terminal_Id[").append(t).append("]=").append(
                            userNumber[t])));
        }

        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append(
                "\r\ndest_Terminal_type=").append(this.getDest_Terminal_Type())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nmsg_Length=")
                .append(this.getMsg_length())));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nmsg_Content=")
                .append(new String(this.getMsg_Content()))));
        outStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(outStr)))).append("\r\nLinkID=").append(
                this.getLinkID())));

        tmpStr = String.valueOf(tmpStr) + String.valueOf(outStr);
        return tmpStr;
    }

    public int getCommandId() {
        return TypeConvert.byte2int(buf,4);
    }

    public String getOutStr() {
        return outStr;
    }

}
